package org.ioc.com.book_test1.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@Aspect
public class TimeAspect {
    @Around("execution(* org.ioc.com.book_test1.controller.*.*(..))")
    public Object timeTest(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        long start=System.currentTimeMillis();
        Object proceed = proceedingJoinPoint.proceed();
        log.info("当前方法耗时"+(System.currentTimeMillis()-start)+"ms");
        return proceed;
    }
}
